-
Notifications
You must be signed in to change notification settings - Fork 110
Additional Doctrine attributes #397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Additional Doctrine attributes #397
Conversation
📝 WalkthroughWalkthroughAdds ten new property-level PHP 8 attributes for address/bounds, extends ClassMetadata to hold their ReflectionProperty refs, centralizes attribute→metadata mapping in AttributeDriver, and populates those new fields in the Doctrine ORM GeocodeEntityListener. Tests and fixtures updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant Entity as Entity
participant Driver as AttributeDriver
participant Metadata as ClassMetadata
participant Listener as GeocodeEntityListener
participant Geo as GeocodingService
Entity->>Driver: inspect properties for mapping attributes
Driver->>Driver: map attribute -> metadata key (PROPERTY_MATRIX)
Driver->>Metadata: construct metadata with ReflectionProperty refs
Listener->>Geo: geocode(address)
Geo-->>Listener: result (lat,lng,bounds,address components)
Listener->>Metadata: read ReflectionProperty refs for new fields
Listener->>Entity: set north/south/east/west and address components
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I tried to fix the CI but I don't really understand what's happening with the tests for Symfony 6.4. I opened an issue for the PHPStan error as it looks like a bug to me: phpstan/phpstan#14067 |
|
I am also not sure.
|
Adds additionnal attributes to be able to automatically map them to Doctrine entities.
5018888 to
5868661
Compare
|
I disabled native lazy objects for Symfony 6.4 and ignored the PHPStan error for now. I hope you're okay with the way I "fixed" the CI 😅 |
|
Still fails 😞 |
225eda1 to
f9d6ab3
Compare
|
Weird, I can't reproduce it, the test suite works locally with PHP 8.4 + Symfony 6.4. I updated by explicitly setting the options to false. If that still doesn't pass, I'll have to try something completely different ! |
Disables the cache clearing as NyholmBundleTest seems to look at a different cache directory than the one available during testing. Also ignore a specific PHPStan error that has been reported as a bug.
f9d6ab3 to
4047600
Compare
|
Hello again 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/Functional/GeocodeEntityListenerTest.php (1)
87-100:⚠️ Potential issue | 🟠 MajorChange
version_compare($ormVersion, '3.0', '<=')toversion_compare($ormVersion, '3.0', '<')In Doctrine ORM 3.0, lazy ghost objects are enabled unconditionally and cannot be disabled. The current condition with
<=applies the config to ORM 3.0.0+, but the setting is unnecessary (no-op) for ORM 3.0 and is actually removed from DoctrineBundle 3.0+ entirely. Restrict this configuration to ORM 2.x by using<instead of<=to match the ORM versions where lazy ghosts are optional.
🧹 Nitpick comments (1)
tests/Functional/GeocodeEntityListenerTest.php (1)
334-351: Consider extracting long mock JSON responses to fixture files.Lines 340 and 346 contain very long inline JSON strings (several KB each), which makes this test file harder to read and maintain. Consider moving these to separate
.jsonfixture files and loading them withfile_get_contents(). This would also make it easier to update the mock data if needed.
Related to #396 : I added attributes for (most, not all) properties matching the getters of the
Locationinterface, so we can easily map them to Doctrine entity properties as we can already do for latitude & longitude. Let me know what you think 🙂Summary by CodeRabbit
New Features
Tests